package com.hengby.hengcrud.modular.job.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

@TableName(value = "T_JOB")
@Setter
@Getter
public class Job extends Model<Job> {

	/**
	 * 任务调度参数key
	 */
	public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";

	public static final String SEQ = "seq_job";

	@Override
	protected Serializable pkVal() {
		return jobId;
	}

	@TableField(value = "JOB_ID")
//	@ExportConfig(value = "任务ID")
	private Long jobId;

	@TableField(value = "BEAN_NAME")
//	@ExportConfig(value = "Bean名称")
	private String beanName;

	@TableField(value = "METHOD_NAME")
//	@ExportConfig(value = "方法名称")
	private String methodName;

	@TableField(value = "PARAMS")
//	@ExportConfig(value = "参数")
	private String params;

	@TableField(value = "CRON_EXPRESSION")
//	@ExportConfig(value = "cron表达式")
	private String cronExpression;

	@TableField(value = "STATUS")
//	@ExportConfig(value = "状态", convert = "s:0=正常,1=暂停")
	private String status;

	@TableField(value = "REMARK")
//	@ExportConfig(value = "备注")
	private String remark;

	@TableField(value = "CREATE_TIME")
//	@ExportConfig(value = "创建时间", convert = "c:cc.mrbird.common.util.poi.convert.TimeConvert")
	private Date createTime;

    public enum ScheduleStatus {
        /**
         * 正常
         */
        NORMAL("0"),
        /**
         * 暂停
         */
        PAUSE("1");

        private String value;

        private ScheduleStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

}